<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="fragment :: common_head(~{::meta},~{::title},~{},~{::style},~{})">
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>

    </style>
</head>
<body>
<header id="header" th:replace="fragment :: header"></header>
<div id="content">
    <form action="" method="post" th:action="@{/employee/emp}" th:object="${employee}">
        <!--
        <ul th:if="${#fields.hasErrors('*')}">
            <li th:each="err: ${#fields.errors('*')}" th:text="${err}"></li>
        </ul>
        -->
        <label>姓名:</label>
        <input type="text" th:field="*{name}" th:errorClass="error">
        <span th:each="err: ${#fields.errors('name')}" th:text="${err}"></span>
        <br>
        <label>性别:</label>
        <span th:each="gen: ${genders}">
            <label th:text="${gen.key}"></label>
            <input type="radio" th:field="*{gender}" th:value="${gen.value}">
        </span>
        <span th:each="err: ${#fields.errors('gender')}" th:text="${err}"></span>
        <br>
        <label>生日:</label>
        <input type="datetime" th:field="*{birthday}" th:errorClass="error">
        <span th:each="err: ${#fields.errors('birthday')}" th:text="${err}"></span>
        <br>
        <label>Email:</label>
        <input type="email" th:field="*{email}">
        <span th:each="err: ${#fields.errors('email')}" th:text="${err}"></span>
        <br>
        <label>部门:</label>
        <select th:field="*{department.id}">
            <option th:each="dept: ${departments}"
                th:value="${dept.id}"
                th:text="${dept.name}">
            </option>
        </select>
        <br>
        <input type="submit" th:value="保存">
    </form>
</div>
<footer id="footer" th:replace="fragment :: footer"></footer>
</body>
</html>